﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link type="text/css" rel="stylesheet" href="/html/css/style.css" />
    <!--[if IE 6]>
    <script src="js/iepng.js" type="text/javascript"></script>
        <script type="text/javascript">
           EvPNG.fix('div, ul, img, li, input, a');
        </script>
    <![endif]-->

    <script type="text/javascript" src="/html/js/jquery-1.8.2.min.js"></script>
    <script type="text/javascript" src="/html/js/menu.js"></script>

    <script type="text/javascript" src="/html/js/n_nav.js"></script>

    <script type="text/javascript" src="/html/js/select.js"></script>

    <script type="text/javascript" src="/html/js/num.js">
    	var jq = jQuery.noConflict();
    </script>

    <script type="text/javascript" src="/html/js/shade.js"></script>

    <title>尤洪</title>
</head>
<body>
    <!--Begin Header Begin-->
    <div class="soubg">
        <div class="sou">
            <!--Begin 所在收货地区 Begin-->
            <span class="s_city_b">
                <span class="fl">送货至：</span>
                <span class="s_city">
                    <span>四川</span>

                </span>
            </span>
            <!--End 所在收货地区 End-->
            <span class="fr">
                <span class="fl">你好，请<a href="Login.html">登录</a>&nbsp; <a href="Regist.html" style="color:#ff4e00;">免费注册</a>&nbsp;|&nbsp;<a href="#">我的订单</a>&nbsp;|</span>
                <span class="ss">
                    <div class="ss_list">
                        <a href="#">收藏夹</a>
                        <div class="ss_list_bg">
                            <div class="s_city_t"></div>
                            <div class="ss_list_c">
                                <ul>
                                    <li><a href="#">我的收藏夹</a></li>
                                    <li><a href="#">我的收藏夹</a></li>
                                </ul>
                            </div>
                        </div>
                    </div>
                    <div class="ss_list">
                        <a href="#">客户服务</a>
                        <div class="ss_list_bg">
                            <div class="s_city_t"></div>
                            <div class="ss_list_c">
                                <ul>
                                    <li><a href="#">客户服务</a></li>
                                    <li><a href="#">客户服务</a></li>
                                    <li><a href="#">客户服务</a></li>
                                </ul>
                            </div>
                        </div>
                    </div>
                    <div class="ss_list">
                        <a href="#">网站导航</a>
                        <div class="ss_list_bg">
                            <div class="s_city_t"></div>
                            <div class="ss_list_c">
                                <ul>
                                    <li><a href="#">网站导航</a></li>
                                    <li><a href="#">网站导航</a></li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </span>
                <span class="fl">|&nbsp;关注我们：</span>
                <span class="s_sh"><a href="#" class="sh1">新浪</a><a href="#" class="sh2">微信</a></span>
                <span class="fr">|&nbsp;<a href="#">手机版&nbsp;<img src="/html/images/s_tel.png" align="absmiddle" /></a></span>
            </span>
        </div>
    </div>
    <div class="top">
        <div class="logo"><a href="Index.html"><img src="/html/images/logo.png" /></a></div>
        <div class="search">
            <form>
                <input type="text" value="" class="s_ipt" />
                <input type="submit" value="搜索" class="s_btn" />
            </form>
            <span class="fl"><a href="#">咖啡</a><a href="#">iphone 6S</a><a href="#">新鲜美食</a><a href="#">蛋糕</a><a href="#">日用品</a><a href="#">连衣裙</a></span>
        </div>
        <div class="i_car">
            <div class="car_t">购物车 [ <span>3</span> ]</div>

        </div>
    </div>
    <!--End Header End-->
    <!--Begin Menu Begin-->
    <div class="menu_bg">
        <div class="menu">
            <!--Begin 商品分类详情 Begin-->
            <div class="nav">
                <div class="nav_t">全部商品分类</div>

            </div>
            <!--End 商品分类详情 End-->


        </div>
    </div>
    <!--End Menu End-->
    <div class="i_bg">
        <div class="content mar_20">
            <img src="/html/images/img2.jpg" />
        </div>

        <!--Begin 第二步：确认订单信息 Begin -->
        <div class="content mar_20">
            <div class="two_bg">
                <div class="two_t">
                    <span class="fr"><a href="#">修改</a></span>商品列表
                </div>
                <table border="0" class="car_tab" style="width:1110px;" cellspacing="0" cellpadding="0">
                    <thead>
                        <tr>
                            <td class="car_th" width="550">商品名称</td>
                            <td class="car_th" width="140">属性</td>
                            <td class="car_th" width="150">购买数量</td>
                            <td class="car_th" width="130">小计</td>
                            <td class="car_th" width="140">返还积分</td>
                        </tr>
                    </thead>
                    <tbody class="tablebody"></tbody>

                  
                    <tr>
                        <td colspan="5" align="right" style="font-family:'Microsoft YaHei';">
                            商品总价：￥1899.00 ； 返还积分 56R
                        </td>
                    </tr>
                </table>

                <div class="two_t">
                    <span class="fr" id="btnAddress"><a href="#" >新增</a></span>收货人信息
                </div>
                <table id="newAddress" class="peo_tab" style="width:1110px;display:none" cellspacing="0" cellpadding="0">
                    <tr>
                        <td>收货人：</td>
                        <td><input name="Reciver" /></td>
                    </tr>
                    <tr>
                        <td>手机号：</td>
                        <td><input name="Phone" /></td>
                    </tr>
                    <tr>
                        <td>详细地址：</td>
                        <td><input name="Detail" /></td>
                    </tr>
                    <tr>
                        <td>是否默认：</td>
                        <td><input type="checkbox" name="IsDefault" value="true" /></td>
                    </tr>
                    <tr>
                        <td>是否默认：</td>
                        <td><input type="submit" id="btnPost" value="确定" /></td>
                    </tr>
                </table>
                <table border="0" class="peo_tab" style="width:1110px;" cellspacing="0" cellpadding="0">
                   
                    <tr>
                        <td class="p_td">详细信息</td>
                        <td class="aDetail">@ViewBag.Address.Detail</td>
                        <td class="p_td">邮政编码</td>
                        <td>6011111</td>
                    </tr>
                    <tr>
                        <td class="p_td">收件人</td>
                        <td class="aReciver">@ViewBag.Address.Reciver</td>
                        <td class="p_td">手机</td>
                        <td class="aPhone">@ViewBag.Address.Phone</td>
                    </tr>
                    <tr>
                        <td class="p_td">标志建筑</td>
                        <td></td>
                        <td class="p_td">最佳送货时间</td>
                        <td></td>
                    </tr>
                </table>


                <div class="two_t">
                    配送方式
                </div>



                <table border="0" style="width:900px; margin-top:20px;" cellspacing="0" cellpadding="0">
                    <tr>
                        <td align="right">
                            该订单完成后，您将获得 <font color="#ff4e00">1815</font> 积分 ，以及价值 <font color="#ff4e00">￥0.00</font> 的红包 <br />
                            商品总价: <font color="#ff4e00">￥1815.00</font>  + 配送费用: <font color="#ff4e00">￥15.00</font>
                        </td>
                    </tr>
                    <tr height="70">
                        <td align="right">
                            <b style="font-size:14px;">应付款金额：￥<span style="font-size:22px; color:#ff4e00;" id="sumMoney">2899</span></b>
                        </td>
                    </tr>
                    <tr height="70">
                        <td align="right"><a href="#" id="btnPostOrder"><img src="/html/images/btn_sure.gif" /></a></td>
                    </tr>
                </table>



            </div>
        </div>
        <!--End 第二步：确认订单信息 End-->
        <!--Begin Footer Begin -->

        <div class="btmbg">
            <div class="btm">
                备案/许可证编号：蜀ICP备12009302号-1-www.dingguagua.com   Copyright © 2015-2018 尤洪商城网 All Rights Reserved. 复制必究 , Technical Support: Dgg Group <br />
               
            </div>
        </div>
        <!--End Footer End -->
    </div>
    
    <script src="~/Scripts/jquery-3.7.1.min.js"></script>
    <script>
        $(function () {
            var order = JSON.parse(sessionStorage.getItem('Order'));
            order.items.forEach(function (item, index) {
                let str = `
                 <tr>
                        <td>
                            <div class="c_s_img"><img src="${item.image}" width="73" height="73" /></div>
                            ${item.ProductInfoName}
                        </td>
                        <td align="center">颜色：${item.color}</td>
                        <td align="center">${item.count}</td>
                        <td align="center" style="color:#ff4e00;">￥${item.price}</td>
                        <td align="center"></td>
                    </tr>
                `;
                $('.tablebody').append($(str));
            })
            $('#sumMoney').text(order.sumprice)

            // 新增收获地址
            $('#btnAddress').click(function () {

                $('#newAddress').slideDown(1000);
                return false;
            })

            // 提交地址
            $('#btnPost').click(function () {
                let reciver = $('input[name=Reciver]').val();
                let phone = $('input[name=Phone]').val();
                let detail = $('input[name=Detail]').val();
                let isDefault = $('input[name=IsDefault]').ischeck;
                var data = {
                    reciver, phone, detail, isDefault
                }
                $.post('/order/CreateAddress', data, function (res) {
                    if (res.success) {
                        $('#newAddress').slideUp(1000);
                        // 给地址赋值
                        $('.aDetail').text(detail)
                        $('.aReciver').text(reciver)
                        $('.aPhone').text(phone)
                    }
                })
            })

            // 提交订单
            $('#btnPostOrder').click(function () {
                let data = {
                    SumPrice: order.sumprice,
                    Address: `${$('.aPhone').text()} ${$('.aReciver').text()} ${$('.aDetail').text() }`,
                    details: order.items
                }
                $.ajax({
                    url: '/order/createorder',
                    type: 'post',
                    data: data,
                    success: function (res) {
                        if (res.success) {
                            alert(res.msg)
                            location = '@Url.Action("Pay")/'+res.data;
                        }
                       
                    }
                })
            })
        })
    </script>
</body>

</html>
